package com.qingxin.park.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 批次产品表（追溯物）
 */
@Entity
@Table(name = "batch_products")
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class BatchProducts extends com.qingxin.sys.entity.BaseEntity implements
		java.io.Serializable {
	private static final long serialVersionUID = 5675866678867342538L;
	// Fields

	private String pdtid;
	private ParkBlockPlant parkBlockPlant;
	private String companyid;
	private String parkid;
	private String pdtname;
	private String pdttype;//类型：1种植、2养殖、3加工
	private String pdtcode;//产品编码，7位数字1000000~9999999
	private String pbn;
	private String status;//状态0:未确认1:已确认
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date beginTime;//种植日期
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date endTime;//生产日期
	private Integer amount;
	private String units;
	private String remark;
	private String worker;
	private String workerName;
	private String pdtimg;
	private String createBy;
	private Date createTime;
	private String updateBy;
	private Date updateTime;
	private String ncsc;//是否已进行农残速测：0无、1有
	private Date ncscTime;
	private Set<BatchProductsReport> batchProductsReports = new HashSet<>(0);

	// Constructors

	/** default constructor */
	public BatchProducts() {
	}

	/** full constructor */
	public BatchProducts(ParkBlockPlant parkBlockPlant, String parkid,
			String pdtname, String pbn, String status, Date beginTime,
			Date endTime, Integer amount, String remark, String worker,
			String workerName, String pdtimg,
			String createBy, Date createTime, String updateBy,
			Date updateTime, Set<BatchProductsReport> batchProductsReports) {
		this.parkBlockPlant = parkBlockPlant;
		this.parkid = parkid;
		this.pdtname = pdtname;
		this.pbn = pbn;
		this.status = status;
		this.beginTime = beginTime;
		this.endTime = endTime;
		this.amount = amount;
		this.remark = remark;
		this.worker = worker;
		this.workerName = workerName;
		this.pdtimg = pdtimg;
		this.createBy = createBy;
		this.createTime = createTime;
		this.updateBy = updateBy;
		this.updateTime = updateTime;
		this.batchProductsReports = batchProductsReports;
	}
	
	

	public BatchProducts(ParkBlockPlant parkBlockPlant, String companyid,
			String parkid, String pdtname, String pdttype, String pbn,
			String status, Date beginTime, Date endTime, Integer amount,
			String remark, String worker, String workerName, String pdtimg,
			String createBy, Date createTime, String updateBy, Date updateTime,
			Set<BatchProductsReport> batchProductsReports) {
		super();
		this.parkBlockPlant = parkBlockPlant;
		this.companyid = companyid;
		this.parkid = parkid;
		this.pdtname = pdtname;
		this.pdttype = pdttype;
		this.pbn = pbn;
		this.status = status;
		this.beginTime = beginTime;
		this.endTime = endTime;
		this.amount = amount;
		this.remark = remark;
		this.worker = worker;
		this.workerName = workerName;
		this.pdtimg = pdtimg;
		this.createBy = createBy;
		this.createTime = createTime;
		this.updateBy = updateBy;
		this.updateTime = updateTime;
		this.batchProductsReports = batchProductsReports;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "pdtid", unique = true, nullable = false, length = 32)
	public String getPdtid() {
		return this.pdtid;
	}

	public void setPdtid(String pdtid) {
		this.pdtid = pdtid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "plantid")
	public ParkBlockPlant getParkBlockPlant() {
		return this.parkBlockPlant;
	}

	public void setParkBlockPlant(ParkBlockPlant parkBlockPlant) {
		this.parkBlockPlant = parkBlockPlant;
	}
	
	@Column(name = "companyid", length = 32)
	public String getCompanyid() {
		return companyid;
	}

	public void setCompanyid(String companyid) {
		this.companyid = companyid;
	}

	@Column(name = "parkid", length = 32)
	public String getParkid() {
		return this.parkid;
	}

	public void setParkid(String parkid) {
		this.parkid = parkid;
	}

	@Column(name = "pdtname", length = 100)
	public String getPdtname() {
		return this.pdtname;
	}

	public void setPdtname(String pdtname) {
		this.pdtname = pdtname;
	}

	@Column(name = "pdttype", length = 1)
	public String getPdttype() {
		return pdttype;
	}

	public void setPdttype(String pdttype) {
		this.pdttype = pdttype;
	}

	@Column(name = "pdtcode", length = 20)
	public String getPdtcode() {
		return pdtcode;
	}

	public void setPdtcode(String pdtcode) {
		this.pdtcode = pdtcode;
	}

	@Column(name = "pbn", length = 20)
	public String getPbn() {
		return this.pbn;
	}

	public void setPbn(String pbn) {
		this.pbn = pbn;
	}

	@Column(name = "status", length = 1)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "begin_time", length = 23)
	public Date getBeginTime() {
		return this.beginTime;
	}

	public void setBeginTime(Date beginTime) {
		this.beginTime = beginTime;
	}

	@Column(name = "end_time", length = 23)
	public Date getEndTime() {
		return this.endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@Column(name = "amount")
	public Integer getAmount() {
		return this.amount;
	}

	public void setAmount(Integer amount) {
		this.amount = amount;
	}
	
	@Column(name = "units", length = 20)
	public String getUnits() {
		return units;
	}

	public void setUnits(String units) {
		this.units = units;
	}

	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "worker", length = 32)
	public String getWorker() {
		return this.worker;
	}

	public void setWorker(String worker) {
		this.worker = worker;
	}

	@Column(name = "worker_name", length = 50)
	public String getWorkerName() {
		return workerName;
	}

	public void setWorkerName(String workerName) {
		this.workerName = workerName;
	}

	@Column(name = "pdtimg", length = 100)
	public String getPdtimg() {
		return pdtimg;
	}

	public void setPdtimg(String pdtimg) {
		this.pdtimg = pdtimg;
	}

	@Column(name = "create_by", length = 32)
	public String getCreateBy() {
		return this.createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	@Column(name = "create_time", length = 23)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_by", length = 32)
	public String getUpdateBy() {
		return this.updateBy;
	}

	public void setUpdateBy(String updateBy) {
		this.updateBy = updateBy;
	}

	@Column(name = "update_time", length = 23)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	
	@Column(name = "ncsc", length = 1)
	public String getNcsc() {
		return ncsc;
	}

	public void setNcsc(String ncsc) {
		this.ncsc = ncsc;
	}

	
	@Column(name = "ncsc_time", length = 23)
	public Date getNcscTime() {
		return ncscTime;
	}

	public void setNcscTime(Date ncscTime) {
		this.ncscTime = ncscTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "batchProducts")
	@JsonIgnore
	public Set<BatchProductsReport> getBatchProductsReports() {
		return this.batchProductsReports;
	}

	public void setBatchProductsReports(
			Set<BatchProductsReport> batchProductsReports) {
		this.batchProductsReports = batchProductsReports;
	}

}